<?php
# MantisBT - a php based bugtracking system
# Copyright (C) 2002 - 2013  MantisBT Team - mantisbt-dev@lists.sourceforge.net
# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.

form_security_validate( 'plugin_MRMailNotificationManager_notifications_update' );

auth_reauthenticate( );
access_ensure_global_level( config_get( 'manage_plugin_threshold' ) );



plugin_config_set('enable_notifications', isset($_POST['enable_notifications']) ? ON : "");


plugin_config_set('owner_new', isset($_POST['owner_new']) ? ON : "");
plugin_config_set('owner_update', isset($_POST['owner_update']) ? ON : "");
plugin_config_set('owner_delete', isset($_POST['owner_delete']) ? ON : "");
plugin_config_set('owner_note_new', isset($_POST['owner_note_new']) ? ON : "");
plugin_config_set('owner_note_update', isset($_POST['owner_note_update']) ? ON : "");
plugin_config_set('owner_note_delete', isset($_POST['owner_note_delete']) ? ON : "");

plugin_config_set('handler_new', isset($_POST['handler_new']) ? ON : "");
plugin_config_set('handler_update', isset($_POST['handler_update']) ? ON : "");
plugin_config_set('handler_delete', isset($_POST['handler_delete']) ? ON : "");
plugin_config_set('handler_note_new', isset($_POST['handler_note_new']) ? ON : "");
plugin_config_set('handler_note_update', isset($_POST['handler_note_update']) ? ON : "");
plugin_config_set('handler_note_delete', isset($_POST['handler_note_delete']) ? ON : "");

plugin_config_set('monitor_new', isset($_POST['monitor_new']) ? ON : "");
plugin_config_set('monitor_update', isset($_POST['monitor_update']) ? ON : "");
plugin_config_set('monitor_delete', isset($_POST['monitor_delete']) ? ON : "");
plugin_config_set('monitor_note_new', isset($_POST['monitor_note_new']) ? ON : "");
plugin_config_set('monitor_note_update', isset($_POST['monitor_note_update']) ? ON : "");
plugin_config_set('monitor_note_delete', isset($_POST['monitor_note_delete']) ? ON : "");

plugin_config_set('notes_new', isset($_POST['notes_new']) ? ON : "");
plugin_config_set('notes_update', isset($_POST['notes_update']) ? ON : "");
plugin_config_set('notes_delete', isset($_POST['notes_delete']) ? ON : "");
plugin_config_set('notes_note_new', isset($_POST['notes_note_new']) ? ON : "");
plugin_config_set('notes_note_update', isset($_POST['notes_note_update']) ? ON : "");
plugin_config_set('notes_note_delete', isset($_POST['notes_note_delete']) ? ON : "");


plugin_config_set('viewer_new', isset($_POST['viewer_new']) ? ON : "");
plugin_config_set('viewer_update', isset($_POST['viewer_update']) ? ON : "");
plugin_config_set('viewer_delete', isset($_POST['viewer_delete']) ? ON : "");
plugin_config_set('viewer_note_new', isset($_POST['viewer_note_new']) ? ON : "");
plugin_config_set('viewer_note_update', isset($_POST['viewer_note_update']) ? ON : "");
plugin_config_set('viewer_note_delete', isset($_POST['viewer_note_delete']) ? ON : "");

plugin_config_set('reporter_new', isset($_POST['reporter_new']) ? ON : "");
plugin_config_set('reporter_update', isset($_POST['reporter_update']) ? ON : "");
plugin_config_set('reporter_delete', isset($_POST['reporter_delete']) ? ON : "");
plugin_config_set('reporter_note_new', isset($_POST['reporter_note_new']) ? ON : "");
plugin_config_set('reporter_note_update', isset($_POST['reporter_note_update']) ? ON : "");
plugin_config_set('reporter_note_delete', isset($_POST['reporter_note_delete']) ? ON : "");

plugin_config_set('updater_new', isset($_POST['updater_new']) ? ON : "");
plugin_config_set('updater_update', isset($_POST['updater_update']) ? ON : "");
plugin_config_set('updater_delete', isset($_POST['updater_delete']) ? ON : "");
plugin_config_set('updater_note_new', isset($_POST['updater_note_new']) ? ON : "");
plugin_config_set('updater_note_update', isset($_POST['updater_note_update']) ? ON : "");
plugin_config_set('updater_note_delete', isset($_POST['updater_note_delete']) ? ON : "");

plugin_config_set('developer_new', isset($_POST['developer_new']) ? ON : "");
plugin_config_set('developer_update', isset($_POST['developer_update']) ? ON : "");
plugin_config_set('developer_delete', isset($_POST['developer_delete']) ? ON : "");
plugin_config_set('developer_note_new', isset($_POST['developer_note_new']) ? ON : "");
plugin_config_set('developer_note_update', isset($_POST['developer_note_update']) ? ON : "");
plugin_config_set('developer_note_delete', isset($_POST['developer_note_delete']) ? ON : "");

plugin_config_set('manager_new', isset($_POST['manager_new']) ? ON : "");
plugin_config_set('manager_update', isset($_POST['manager_update']) ? ON : "");
plugin_config_set('manager_delete', isset($_POST['manager_delete']) ? ON : "");
plugin_config_set('manager_note_new', isset($_POST['manager_note_new']) ? ON : "");
plugin_config_set('manager_note_update', isset($_POST['manager_note_update']) ? ON : "");
plugin_config_set('manager_note_delete', isset($_POST['manager_note_delete']) ? ON : "");

plugin_config_set('admin_new', isset($_POST['admin_new']) ? ON : "");
plugin_config_set('admin_update', isset($_POST['admin_update']) ? ON : "");
plugin_config_set('admin_delete', isset($_POST['admin_delete']) ? ON : "");
plugin_config_set('admin_note_new', isset($_POST['admin_note_new']) ? ON : "");
plugin_config_set('admin_note_update', isset($_POST['admin_note_update']) ? ON : "");
plugin_config_set('admin_note_delete', isset($_POST['admin_note_delete']) ? ON : "");


form_security_purge( 'plugin_MRMailNotificationManager_notifications_update' );

print_successful_redirect( plugin_page( 'notifications/notifications', true ) );
